include:
    - prod.keepalived.install


{% if pillar.get('keepalived','') %}

/etc/rsyslog.conf:
    file.append:
        - text:
            - local3.*   /var/log/keepalived.log
        - unless: cat /etc/rsyslog.conf|grep keepalived
    service.running:
        - name: rsyslog
        - enable: True
        - reload: True


keepalived-service:
    file.managed:
        - name: /etc/keepalived/keepalived.conf
        - source: salt://prod/keepalived/files/keepalived.conf
        - mode: 644
        - user: root
        - group: root
        - template: jinja

    service.running:
        - name: keepalived
        - enable: True
        - reload: True
        - watch:
            - file: keepalived-service

{% endif %}
